@extends('admin.layouts.app')
@section('title', '系统设置')
@section("js-head")
    <script></script>
@endsection
@section("content")
    <div class="app-crumb">
        <div class="jing-breadcrumb">
            <i class="jingui-font icon-home"></i>
            <a href="/">首页</a>
            <a><cite>系统设置</cite></a>
        </div>
    </div>
    @foreach($errors->all() as $error)
        <div class="app-page-error">
            <div class="error">
                <i class="jing-icon jing-icon-face-smile"></i> <span class="txt">{{ $error }}</span>
            </div>
            <i class="jing-icon jing-unselect jing-tab-close app-error-close">&#x1006;</i>
        </div>
    @endforeach
    <div class="app-main">
        <!--/search-->
        <div class="app-result app-system">
            <div class="jing-tab app-system-tab jing-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="jing-tab-title">
                    <li class="jing-this">网站设置</li>
                    <li>模板管理</li>
                </ul>
                <div class="jing-tab-content">
                    <div class="jing-tab-item jing-show">
                        <div class="app-mini-result">
                            <fieldset class="jing-elem-field jing-field-title">
                                <legend>网站信息设置</legend>
                            </fieldset>
                            <form class="jing-form app-site-form" action="{{ url('admin/system/update') }}" method="post" lay-filter="example">
                                @method('PATCH')
                                @csrf
                                <div class="jing-form-item">
                                    <label class="jing-form-label">域名</label>
                                    <div class="jing-input-block">
                                        <input type="text" name="domain" value="{{ config('site.domain') }}" lay-verify="title" autocomplete="off" placeholder="请输入域名" class="jing-input">
                                    </div>
                                </div>
                                <div class="jing-form-item">
                                    <label class="jing-form-label">站点标题</label>
                                    <div class="jing-input-block">
                                        <input type="text" name="title" value="{{ config('site.title') }}" lay-verify="title" autocomplete="off" placeholder="请输入站点标题" class="jing-input">
                                    </div>
                                </div>
                                <div class="jing-form-item">
                                    <label class="jing-form-label">关键字</label>
                                    <div class="jing-input-block">
                                        <input type="text" name="keywords" value="{{ config('site.keywords') }}" lay-verify="title" autocomplete="off" placeholder="请输入关键字" class="jing-input">
                                    </div>
                                </div>
                                <div class="jing-form-item">
                                    <label class="jing-form-label">描述</label>
                                    <div class="jing-input-block">
                                        <input type="text" name="description" value="{{ config('site.description') }}" lay-verify="title" autocomplete="off" placeholder="请输入描述" class="jing-input">
                                    </div>
                                </div>
                                <div class="jing-form-item">
                                    <label class="jing-form-label">博客标题</label>
                                    <div class="jing-input-block">
                                        <input type="text" name="blogTitle" value="{{ config('site.blogTitle') }}" lay-verify="title" autocomplete="off" placeholder="请输入博客标题" class="jing-input">
                                    </div>
                                </div>
                                <div class="jing-form-item">
                                    <label class="jing-form-label">博客关键字</label>
                                    <div class="jing-input-block">
                                        <input type="text" name="blogKeywords" value="{{ config('site.blogKeywords') }}" lay-verify="title" autocomplete="off" placeholder="请输入博客关键字" class="jing-input">
                                    </div>
                                </div>
                                <div class="jing-form-item">
                                    <label class="jing-form-label">博客描述</label>
                                    <div class="jing-input-block">
                                        <input type="text" name="blogDescription" value="{{ config('site.blogDescription') }}" lay-verify="title" autocomplete="off" placeholder="请输入描述" class="jing-input">
                                    </div>
                                </div>
                                <div class="jing-form-item">
                                    <div class="jing-input-block">
                                        <button type="submit" class="jing-btn" lay-submit="" lay-filter="demo1">保存</button>
                                        <button type="button" class="jing-btn jing-btn-primary" id="LAY-component-form-getval">返回</button>
                                    </div>
                                </div>
                                <fieldset class="jing-elem-field jing-field-title">
                                    <legend>站长信息设置</legend>
                                </fieldset>
                                <div class="jing-form-item">
                                    <label class="jing-form-label">联系邮箱</label>
                                    <div class="jing-input-block">
                                        <input type="text" name="email" value="{{ config('site.email') }}" lay-verify="email" autocomplete="off" placeholder="网站联系邮箱" class="jing-input">
                                    </div>
                                </div>
                                <div class="jing-form-item">
                                    <label class="jing-form-label">联系人</label>
                                    <div class="jing-input-block">
                                        <input type="text" name="contact" value="{{ config('site.contact') }}" lay-verify="contact" autocomplete="off" placeholder="联系人" class="jing-input">
                                    </div>
                                </div>
                                <div class="jing-form-item">
                                    <label class="jing-form-label">公司名称</label>
                                    <div class="jing-input-block">
                                        <input type="text" name="company" value="{{ config('site.company') }}" lay-verify="company" autocomplete="off" placeholder="公司名称" class="jing-input">
                                    </div>
                                </div>
                                <div class="jing-form-item">
                                    <label class="jing-form-label">联系电话</label>
                                    <div class="jing-input-block">
                                        <input type="text" name="phone" value="{{ config('site.phone') }}" autocomplete="off" placeholder="联系电话" class="jing-input">
                                    </div>
                                </div>
                                <div class="jing-form-item">
                                    <label class="jing-form-label">备案ICP</label>
                                    <div class="jing-input-block">
                                        <input type="text" name="icp" value="{{ config('site.icp') }}" lay-verify="icp" autocomplete="off" placeholder="备案ICP" class="jing-input">
                                    </div>
                                </div>
                                <div class="jing-form-item">
                                    <label class="jing-form-label">博客描述</label>
                                    <div class="jing-input-block">
                                        <input type="text" name="address" value="{{ config('site.address') }}" lay-verify="address" autocomplete="off" placeholder="请输入描述" class="jing-input">
                                    </div>
                                </div>
                                <div class="jing-form-item">
                                    <label class="jing-form-label">模板设置</label>
                                    <div class="jing-input-block">
                                        <div class="app-tpl-row jing-col-space10">
                                            <input type="hidden" class="tpl" name="tpl" value="{{ config('site.tpl') }}" />
                                            <div class="tpl-item" data-type="default">
                                                <h2>默认</h2>
                                                <img class="tpl-img" src="{{ asset('/static/images/tpl-01.jpg') }}" alt="">
                                                <a class="jing-btn btn-prew">预览</a>
                                            </div>
                                            <div class="tpl-item" data-type="green">
                                                <h2>春意昂然</h2>
                                                <img class="tpl-img" src="{{ asset('/static/images/tpl-02.jpg') }}" alt="">
                                                <a class="jing-btn btn-prew">预览</a>
                                            </div>
                                            <div class="tpl-item" data-type="black">
                                                <h2>秋天丰收</h2>
                                                <img class="tpl-img" src="{{ asset('/static/images/tpl-01.jpg') }}" alt="">
                                                <a class="jing-btn btn-prew">预览</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="jing-form-item">
                                    <div class="jing-input-block">
                                        <input type="hidden" name="file" value="site.php" />
                                        <button type="submit" class="jing-btn" lay-submit="" lay-filter="demo1">保存</button>
                                        <button type="button" class="jing-btn jing-btn-primary" id="LAY-component-form-getval">返回</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <!--/网站设置-->
                    <div class="jing-tab-item">
                        <div class="app-mini-result">
                            <div class="jing-row app-tpl-row jing-col-space10">
                                <div class="tpl-item" data-type="default">
                                    <h2>默认</h2>
                                    <img class="tpl-img" src="{{ asset('/static/images/tpl-01.jpg') }}" alt="">
                                    <a class="jing-btn btn-prew">预览</a>
                                </div>
                                <div class="tpl-item" data-type="green">
                                    <h2>春意昂然</h2>
                                    <img class="tpl-img" src="{{ asset('/static/images/tpl-02.jpg') }}" alt="">
                                    <a class="jing-btn btn-prew">预览</a>
                                </div>
                                <div class="tpl-item" data-type="black">
                                    <h2>秋天丰收</h2>
                                    <img class="tpl-img" src="{{ asset('/static/images/tpl-01.jpg') }}" alt="">
                                    <a class="jing-btn btn-prew">预览</a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--/模板管理-->
                </div>
            </div>
        </div>
        <!--/result-->
    </div>
    <!--/body-->
    <form action="" method="POST">
        @csrf
        @method('DELETE')
    </form>
@endsection
@section('js')
    <script>
        layui.use(['laypage', 'jquery'], function () {
            var laypage = layui.laypage
            var $ = layui.jquery

            //总页数大于页码总数
            laypage.render({
                elem: 'js-page',
                count: 70, //数据总数
                jump: function (obj) {
                    // console.log(obj)
                }
            });

            $('.delete').click(function () {
                $('form').attr('action', this.href).submit();
                return false;
            })

            $('.app-error-close').click(function () {
                $('.app-page-error').fadeOut()
            })
        });

        $(function () {
            PageIndex.init()
        })

        var PageIndex = {
            init: function () {
                this.bind()
                this.tpl()
            },
            bind: function () {
                var self = this

                $('.app-tpl-row').off('.item').on('click.item', '.tpl-item', function () {
                    var scope = $(this),
                        type = scope.data('type')

                    scope.siblings().removeClass('on').end().addClass('on')
                    // alert(type);
                    self.onTplSelected(type)
                    return false
                })
            },
            tpl: function () {
                var self = this

                $('.tpl-item').each(function () {
                    if ($(this).data('type') === $('.tpl').val()) {
                        $(this).addClass('on')
                    }
                })
            },
            onTplSelected: function (type) {
                $('.tpl').val(type)
            }
        }
    </script>
@endsection
